using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Pavilion;
using Pavilion.Control;

namespace PavilionGame
{
    public class NarrativeMenu : Control
    {
        private Panel panel;
        private Button start, close;
        private Label label;

        public event Action ClosePressed;

        public NarrativeMenu(Rectangle bounds)
        {
            AreaBounds = bounds;

            panel = new Panel(new Rectangle(0, 0, bounds.Width, bounds.Height));
            label = new Label("Narritive Menu", new Rectangle(10, 0, 180, 40), new Color(0, 0, 0, 128));
            start = new Button("Start", new Rectangle(25, 150, 100, 40), 0.5f);
            close = new Button("Close", new Rectangle(25, 200, 100, 40), 0.5f);

            panel.BackgroundColor = new Color(128, 128, 128, 128);
            panel.Collection.Add(start);
            panel.Collection.Add(close);
            panel.Collection.Add(label);

            this._Collection.Add(panel);

            start.Pressed += new Action(Start_ButtonPressed);
            close.Pressed += new Action(Close_ButtonPressed);
        }

        public override void Dispose()
        {
            start.Pressed -= new Action(Start_ButtonPressed);
            close.Pressed -= new Action(Close_ButtonPressed);

            base.Dispose();
        }

        private void Close_ButtonPressed()
        {
            Visible = false;
            if (ClosePressed != null)
                ClosePressed();
        }

        private void Start_ButtonPressed()
        {
            GameSession.RequestSessionLoad(this, "Main");
            //Engine.Instance.LoadComponent(typeof(Narrative));
        }
    }
}
